  import {
      createBtnHandler
  } from './create';
  import {
      editBtnHandler
  } from './edit';
  import {
      removeBtnHandler
  } from './remove';
    import {grid} from '../common/grid';
  import {
      editPwd,loginOut
  } from '../common/settings';
  $(function () {

      grid();
   window.editPwd=editPwd;
      window.loginOut=loginOut;
      let $table = $('#table').bootstrapTable({
          toolbar: '#toolbar',
          url: GLOBAL_roleListUrl,
          sidePagination: "server",
          queryParamsType: '',
          columns: [{
              checkbox: true
          }, {
              field: 'rolename',
              title: '角色',
              sortable: true
          }]
      });

      //多选不能编辑
      $table.on('check.bs.table', () => {
          let selectedList = $('#table').bootstrapTable('getSelections');
          if (selectedList.length > 1) {
              $('#editBtn').attr('disabled', 'disabled');
              return;
          }
          $('#editBtn').removeAttr('disabled');
      });
      $table.on('uncheck.bs.table', () => {
          let selectedList = $('#table').bootstrapTable('getSelections');
          if (selectedList.length > 1) {
              $('#editBtn').attr('disabled', 'disabled');
              return;
          }
          $('#editBtn').removeAttr('disabled');
      });
      $table.on('check-all.bs.table', (rows) => {
          $('#editBtn').attr('disabled', 'disabled');
      });
      $table.on('uncheck-all.bs.table', (rows) => {
          $('#editBtn').removeAttr('disabled');
      });



      window.createBtnHandler = createBtnHandler;
      window.editBtnHandler = editBtnHandler;
      window.removeBtnHandler = removeBtnHandler;






  }());